import { createRouter, createWebHistory } from "vue-router";

import Login from '../views/login/index.vue'

// manage 部分
import Manage from '../views/manage/index.vue'
import ManageHome from '../views/manage/home/index.vue'
import ManageMen from '../views/manage/man/index.vue'
import ManageProfile from '../views/manage/components/profile.vue'
import ManageWomen from '../views/manage/woman/index.vue'
import ManageAbout from '../views/manage/about/index.vue'
import ManageMessage from '../views/manage/messageBox/index.vue'
import ManageMyProfile from '../views/manage/profile/index.vue'

import Home from '../views/home/index.vue'
import HomeBody from '../views/home/components/body.vue'
import MenIndex from '../views/man/index.vue'
import MenBody from '../views/man/components/body.vue'
import HomeProfile from '../views/components/profile.vue'

import WomenIndex from '../views/woman/index.vue'
import WomenBody from '../views/woman/components/body.vue'

import About from '../views/about/index.vue'
import Contact from '../views/contact/index.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: "/login",
      component: Login,
    },
    {
      path: "/manage",
      component: Manage,
      redirect:'/manage/home',
      children: [
        { path: "home", component: ManageHome },
        { path: "men", component: ManageMen },
        {path:'men/:id',component:ManageProfile},
        { path: "women", component: ManageWomen },
        {path:'women/:id',component:ManageProfile},
        {path:'about',component:ManageAbout},
        {path:'message',component:ManageMessage},
        {path:'profile',component:ManageMyProfile}
      ],
    },
    {
      path: "/",
      component: Home,
      redirect: "/home",
      children: [
        {
          path: "home",
          component: HomeBody,
        },
        {
          path: "men",
          redirect: "/men/index/all",
          children: [
            {
              path: "index",
              component: MenIndex,
              children: [
                {
                  path: "all",
                  component: MenBody,
                },
                {
                  path: "guangzhou",
                  component: MenBody,
                },
              ],
            },
            {
              path: "profile/:id",
              component: HomeProfile,
            },
          ],
        },
        {
          path: "women",
          redirect: "/women/index/all",
          children: [
            {
              path: "index",
              component: WomenIndex,
              children: [
                {
                  path: "all",
                  component: WomenBody,
                },
                {
                  path: "guangzhou",
                  component: WomenBody,
                },
              ],
            },
            {
              path: "profile/:id",
              component: HomeProfile,
            },
          ],
        },
        {
          path: "about",
          component: About,
        },
        {
          path: "contact",
          component: Contact,
        },
      ],
    },
  ],
});

export default router;
